package com.woniuxy.micromessageserver.messagemag.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.micromessageserver.bean.NewsBean;
import com.woniuxy.micromessageserver.bean.PageRequest;
import com.woniuxy.micromessageserver.messagemag.mapper.NewsMapper;
import com.woniuxy.micromessageserver.messagemag.service.INewsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class NewsServiceImpl implements INewsService {

    @Resource
    private NewsMapper newsMapper;
    /**
     * 1 根据参数进行分页查询
     * @param request 分页请求对象
     * @param newsBean 条件  根据userid 和 消息类型
     * @return
     */
    @Override
    public PageInfo<NewsBean> findNewsByUidAndType(PageRequest request, NewsBean newsBean) {

        return PageHelper.startPage(request.getPageNum(),request.getLimit()).
                doSelectPageInfo(()->newsMapper.findNewsByUidAndType(request,newsBean));
    }




}
